import React, {Component} from 'react';
import BasicTab from '../ErpBase/BasicTab';
import BaseSetting from './components/BaseSetting';
import BaseSafe from './components/BaseSafe';
import './ErpSetting.scss';

export default class ErpSetting extends Component{
  constructor(props) {
     super(props);
     this.state = {
       tab:'baseInfo'
     }
  }

  //初始化
  componentWillMount(){
    this.setState({
      tab:this.props.match.params != undefined?this.props.match.params.path:'baseInfo'
    })
  }

  render(){
    const tabs = [
      { tab: '基本设置', key: 'baseInfo'},
      { tab: '安全设置', key: 'analysis'},
    ];
    return(
      <div className="base-setting-main">
        <BasicTab tabs={tabs} activeKey={this.state.tab} changeTab={(val)=> this.setState({tab:val})}/>
        {
          this.state.tab == 'analysis'?
            <BaseSafe />
          :
            <BaseSetting />
        }
      </div>
    )
  }

}
